<?php
class SearchController extends Controller{
    public $layout='//layouts/column1';
    
    public function actionIndex(){
        
        if (Yii::app()->request->isAjaxRequest)
        {
            if (isset($_POST['input-search']))
            {
               $url ="index.php?r=search/search&request=".$_POST['input-search'];
               echo "<script>window.location.href = '".$url."';</script>";
              
            }
        }
    }
      
    public function actionSearch($request){
        $criteria = new CDbCriteria;
        $criteria->compare('name',$request, true);
        $dataProvider=new CActiveDataProvider('Job',array(
            'criteria'=>$criteria,
            'pagination'=>array(
                'pageSize'=>5,
            ),
        ));
        
        $dataProvider1=new CActiveDataProvider('Service',array(
            'criteria'=>$criteria,
            'pagination'=>array(
                'pageSize'=>5,
            ),
        ));
        
        $this->render('search',array(
            'dataProvider'=>$dataProvider,
            'dataProvider1'=>$dataProvider1,
        ));
    }
}
      
?>